package com.syqc.utils

import com.syqc.comlib.utils.MLog
import com.syqc.entity.Dictionary
import com.syqc.net.ServiceHelper


/**
 *@Author Jasper
 *@Time   2020/10/19
 *@Desc   提前请求处理类
 */
object NetDataUtil {
    ///////////////////////////////////////////////////////////////////////////////////////////////////
    var colors: MutableList<Dictionary.PlateColor>? = null
    fun getColor() {
        ServiceHelper.getRepository().getDictionary("PLATE_COLOR").subscribe({
            colors = it.PLATE_COLOR
        }, {
            MLog.e("报错了" + it.message)
        })
    }

    fun getColorByName(name: String): String {
        colors?.forEach {
            if (it.name == name) return it.id
        }
        return ""
    }
    //是否同步树
    var isSyncTree = false
    fun getUserSet() {
        ServiceHelper.getRepository().getUserExt().subscribe({
            isSyncTree = it.contains("524")
        }, {
            isSyncTree = false
        })
    }
}